package com.yss.controller;

import com.yss.vo.Person;
import org.springframework.http.HttpRequest;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RestController
public class PersonController {

    @RequestMapping(value = "/call/{id}",method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_VALUE)
    public Person call(@PathVariable Integer id, HttpServletRequest request) {
        Person p = new Person();
        p.setId(id);
        p.setName("angle");
        p.setMsg(request.getRequestURL().toString());
        return p;
    }
}
